import pandas
from matplotlib import pyplot

FN = "predict.df.csv"

df = pandas.read_csv(FN, index_col=0)

# valid-len
vf = df["len"][~df["valid"]]
vt = df["len"][ df["valid"]]
bp = pyplot.boxplot([vf,vt])

#print(bp)
#print(bp["boxes"][0].get_xydata())

points = [ (x, y) for m in ["medians", "caps", "boxes"] \
                  for p in bp[m] \
                  for x, y in p.get_xydata()[1::2]
]
for x,y in points:
    pyplot.annotate(str(y), (x,y))
    
pyplot.show()


pyplot.close()
# correct-len
vf = df["len"][~df["correct"]]
vt = df["len"][ df["correct"]]
bp = pyplot.boxplot([vf,vt])

#print(bp)
#print(bp["boxes"][0].get_xydata())

points = [ (x, y) for m in ["medians", "caps", "boxes"] \
                  for p in bp[m] \
                  for x, y in p.get_xydata()[1::2]
]
for x,y in points:
    pyplot.annotate(str(y), (x,y))
    
pyplot.show()
